<div id="tab7" class="tab">
    <div class="tab-labels">
        <div class="xian"></div>
        三者财务损失
    </div>
    <div id="div6">
        <div style="border:1px solid #FF5722; padding-top: 10px;">
            <form action="" method="post" id="szwusun_forms">
                <table class="layui-table" id="tabProduct666">
                    <tr style="background:#4e73df;color: #fff;" class="ys">
                        <td style="width: 66px;">选择</td>
                        <td>序号</td>
                        <td>财物名称</td>
                        <td>服务种类</td>
                        <td>价格方案</td>
                        <!-- <td>价格</td> -->
                        <!-- <td>数量</td> -->
                        <td>金额</td>
                        <!-- <td>核定价格</td> -->
                        <!-- <td>核定数量</td> -->
                        <td>核定金额</td>
                        <td>备注</td>
                    </tr>
                    {empty name="scwusun"}
                    <tr>
                        <td><input type="checkbox" style="width: 15px;height: 15px;display: block;" name="id"
                                   class="cid666"
                                   value=""></td>
                        <td><input type="text" name="xuhao" class="xuhao666" readonly value="1"></td>
                        <td><input type="text" name="type" class="type666" list="tongchou">
                            <datalist id="tongchou">
                                <option value="机动车损失服务">机动车损失服务</option>
                                <option value="机动车第三者责任服务">机动车第三者责任服务</option>
                                <option value="机动车全车盗抢服务">机动车全车盗抢服务</option>
                                <option value="自燃损失服务">自燃损失服务</option>
                                <option value="发动机涉水损失服务">发动机涉水损失服务</option>
                                <option value="指定修理厂服务">指定修理厂服务</option>
                                <option value="车上货物责任服务">车上货物责任服务</option>
                                <option value="玻璃单独破碎服务">玻璃单独破碎服务</option>
                            </datalist>
                        </td>
                        <td><input type="text" readonly name="name" class="name666"></td>
                        <td><input type="text" readonly name="fangan" class="fangan666" list="peijians">
                            <datalist id="peijians">
                                <option value="4S店维修">4S店维修</option>
                                <option value="一类修理厂">一类修理厂</option>
                                <option value="二类修理厂">二类修理厂</option>
                                <option value="三类修理厂">三类修理厂</option>
                            </datalist>
                        </td>
                        <td><input type="text" readonly name="money" class="money666" oninput="va6()"></td>

                        <td><input type="text" readonly name="hejia" class="hejia666" oninput="va6()"></td>
                        <td><input type="text" readonly name="beizhu" class="beizhu666"></td>
                    </tr>
                    {/empty}
                    {volist name="scwusun" id="sanchess_wu"}
                    <tr>
                        <td><input id="sancai_id_{$sanchess_wu.id}" type="checkbox"
                                   style="width: 15px;height: 15px;display: block;" name="id" class="cid666"
                                   value="{$sanchess_wu.id}"></td>
                        <td>
                            <input id="sancai_xuhao_{$sanchess_wu.id}" type="text" name="xuhao" readonly
                                   class="xuhao666"
                                   value="{$sanchess_wu.xuhao}">
                        </td>
                        <td><input id="sancai_name_{$sanchess_wu.id}" onclick="openDialogs666({$sanchess_wu.id})"
                                   style="text-decoration: underline;color:blue;cursor: pointer;" type="text" readonly
                                   name="name" class="name666" value="{$sanchess_wu.name}"></td>
                        <td><input id="sancai_type_{$sanchess_wu.id}" type="text" readonly name="type" class="type666"
                                   list="tongchou5s" value="{$sanchess_wu.type}">
                            <datalist id="tongchou5s">
                                <option value="机动车损失服务">机动车损失服务</option>
                                <option value="机动车第三者责任服务">机动车第三者责任服务</option>
                                <option value="机动车全车盗抢服务">机动车全车盗抢服务</option>
                                <option value="自燃损失服务">自燃损失服务</option>
                                <option value="发动机涉水损失服务">发动机涉水损失服务</option>
                                <option value="指定修理厂服务">指定修理厂服务</option>
                                <option value="车上货物责任服务">车上货物责任服务</option>
                                <option value="玻璃单独破碎服务">玻璃单独破碎服务</option>
                            </datalist>
                        </td>
                        <td><input id="sancai_fangan_{$sanchess_wu.id}" type="text" readonly name="fangan"
                                   class="fangan666"
                                   list="bencai" value="{$sanchess_wu.fangan}">
                            <datalist id="bencai">
                                <option value="4S店维修">4S店维修</option>
                                <option value="一类修理厂">一类修理厂</option>
                                <option value="二类修理厂">二类修理厂</option>
                                <option value="三类修理厂">三类修理厂</option>
                            </datalist>
                        </td>
                        <td><input id="sancai_money_{$sanchess_wu.id}" type="text" readonly name="money"
                                   class="money666"
                                   value="{$sanchess_wu.jin_e}" oninput="va6()"></td>
                        <td><input type="text" readonly name="hejia" class="hejia666" value="{$sanchess_wu.hd_c_zongji}"
                                   oninput="va6()"></td>
                        <td><input type="text" readonly name="beizhu" class="beizhu666" value="{$sanchess_wu.beizhu}">
                        </td>
                    </tr>
                    {/volist}
                </table>
                {if $scwusun[0]['status'] eq 1}
                <div class="conts">
                    <span style="width:98%;margin: 1%;">审核意见</span>
                    <textarea name="" id="chesun_4_text" cols="30" rows="10"
                              style="width:98%;height: 100px;margin: 1%;"></textarea>
                </div>

                <div style="padding: 10px;display: flex;justify-content: center;">

                    <button type="button" class="layui-btn layui-btn-danger" id="chesun_4">三者财物损失通过审核</button>

                    <button type="button" class="layui-btn layui-btn-warm" id="chesun_bk4">退回</button>

                </div>
                {/if}
            </form>
        </div>
    </div>
    <div id="light666" class="white_content">
        <div class="content">
            <!--三者车-->
            <div>
                <form action="" id="sanwu_form">
                    <input type="hidden" name="id" value="{$orderid}">
                    <input type="hidden" name="bid" class="bid" value="">
                    <div class="titles">
                        <p><font></font>三者财物定损</p>
                    </div>
                    <!--            <form action="">-->
                    {if $scwusun[0]['status'] eq 1}
                        <input type="button" onclick="hd_sanwu(this)" value="保存数据"
                           style="padding: 5px 10px;height:30px;border: none;background:#1b4fe7;color: #fff;">
                    {/if}

                    <table class="layui-table" id="tabProduct46">
                        <tr style="background:#4e73df;color: #fff;" class="ys">
                            <td style="width: 66px;">选择</td>
                            <td>序号</td>
                            <!-- <td>服务种类</td> -->
                            <td>财物名称</td>
                            <td>价格方案</td>
                            <td>价格</td>
                            <td>数量</td>
                            <td>金额</td>
                            <!-- <td>折扣</td> -->
                            <td>核定价格</td>
                            <td>核定数量</td>
                            <td>核价金额</td>
                            <td>备注</td>
                        </tr>
                        <tr>
                            <td><input type="checkbox" style="width: 15px;height: 15px;display: block;" name="id"
                                       class="bid2" value=""></td>
                            <td><input type="text" name="xuhao" readonly class="xuhao2" value="1"></td>
                            <datalist id="tongchou4">
                                <option value="机动车损失服务">机动车损失服务</option>
                                <option value="机动车第三者责任服务">机动车第三者责任服务</option>
                                <option value="机动车全车盗抢服务">机动车全车盗抢服务</option>
                                <option value="自燃损失服务">自燃损失服务</option>
                                <option value="发动机涉水损失服务">发动机涉水损失服务</option>
                                <option value="指定修理厂服务">指定修理厂服务</option>
                                <option value="车上货物责任服务">车上货物责任服务</option>
                                <option value="玻璃单独破碎服务">玻璃单独破碎服务</option>
                            </datalist>
                            </td>
                            <td><input type="text" name="name" class="name2"></td>
                            <td><input type="text" name="fangan" class="fangan2" list="sancais">
                                <datalist id="sancais">
                                    <option value="4S店维修">4S店维修</option>
                                    <option value="一类修理厂">一类修理厂</option>
                                    <option value="二类修理厂">二类修理厂</option>
                                    <option value="三类修理厂">三类修理厂</option>
                                </datalist>
                            </td>
                            <td><input type="text" name="price" class="price2" oninput="v26()"></td>
                            <td><input type="text" name="num" class="num2" oninput="v26()"></td>
                            <td><input type="text" name="money" class="money2" oninput="v26()"></td>
                            <!-- <td><input type="text" name="zhekou" class="zhekou2" value="100" oninput="v26()"></td> -->
                            <td><input readonly type="text" name="price_he" class="price_he2" oninput="v26()"></td>
                            <td><input readonly type="text" name="num_he" class="num_he2" oninput="v26()"></td>
                            <td><input readonly type="text" name="hejia" class="hejia2" oninput="v26()"></td>
                            <td><input type="text" name="beizhu" class="beizhu2"></td>
                        </tr>
                    </table>
                    <table class="layui-table" id="he4">
                        <tr>
                            <td>小计</td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <!-- <td><input type="text" readonly></td> -->
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" id="c_money" name="c_money" class="c_money"></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" readonly></td>
                            <td><input type="text" id="hd_e_money" name="c_hejia" class="hd_e_money"></td>
                            <td><input type="text" readonly></td>

                        </tr>
                    </table>
                    <script>

                        function v26() {
                            var price = $('.price2');
                            var num = $('.num2');
                            var moneys = $('.money2');
                            /*var zhekous = $('.zhekou2');*/
                            var price_hes = $('.price_he2');
                            var num_hes = $('.num_he2');
                            // var hejias = $('.hejia2');

                            var money1 = new Array();
                            for (var i = 0; i < price.length; i++) {
                                money1[i] = price[i].value * num[i].value;
                                moneys[i].value = money1[i];
                                // hejias[i].value = (price_hes[i].value * num_hes[i].value).toFixed(2);
                            }
                            var money = new Array();
                            var result = 0;
                            for (var i = 0; i < moneys.length; i++) {
                                money[i] = parseFloat(moneys[i].value);
                                result += money[i];
                            }
                            var benche_money = document.getElementById('c_money');
                            var c_heji = document.getElementById('c_heji');
                            if (result > 0) {
                                benche_money.value = result.toFixed(2);
                                c_heji.value = result.toFixed(2);
                            }

                            // var hejia = new Array();
                            var results = 0;
                            // for(var i = 0;i < hejias.length;i++){
                            //     hejia[i] = parseFloat(hejias[i].value);
                            //     results += hejia[i];
                            // }
                            // var benche_hejia = document.getElementById('c_hejia');
                            var benche_heji = document.getElementById('c_heji');
                            if (results > 0) {
                                // benche_hejia.value = results.toFixed(2);
                                benche_heji.value = results.toFixed(2);
                            }

                            var sancai_heji = document.getElementById('c_heji').value;
                            var sancai_canzhi = document.getElementById('c_canzhi').value;
                            var sancai_zongji = document.getElementById('c_zongji');
                            var number = (Number(sancai_heji) - Number(sancai_canzhi)).toFixed(2);
                            $(".c_zongji").val(number);
                        }
                    </script>
                    <!--<p>汇总</p>-->
                    <div class="conts">
                        <div class="input">
                            <span>合计</span>
                            <input readonly type="text" placeholder="合计" id="c_heji" name="c_heji" class="c_heji">
                        </div>
                        <div class="input">
                            <span>残值</span>
                            <input readonly type="text" value="0" placeholder="残值" id="c_canzhi" oninput="v26()" class="c_canzhi"
                                   name="c_canzhi">
                        </div>
                        <div class="input">
                            <span>财物总计</span>
                            <input readonly type="text" placeholder="财物总计" id="c_zongji" name="c_zongji" class="c_zongji">
                        </div>
                    </div>
                    <div class="conts">
                        <div class="input">
                            <span>核定合计</span>
                            <input oninput="hd_e()" type="text" placeholder="核定合计" id="hd_e_heji" name="c_heji" class="hd_e_heji">
                        </div>
                        <div class="input">
                            <span>核定残值</span>
                            <input type="text" value="0" placeholder="残值" id="hd_e_canzhi" oninput="hd_e()"
                                   name="c_canzhi" class="hd_e_canzhi">
                        </div>
                        <div class="input">
                            <span>核定财物总计</span>
                            <input type="text" placeholder="核定财物总计" id="hd_e_zongji" name="c_zongji" class="hd_e_zongji">
                        </div>
                    </div>
                    {if $scwusun[0]['status'] eq 3}
                    <div class="conts">
                        <div class="input dong">
                            <span>诉讼费</span>
                            <input readonly type="text" placeholder="诉讼费" id="sancai_susong" name="sancai_susong" class="sancai_susong"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>鉴定费</span>
                            <input readonly type="text" placeholder="鉴定费" id="sancai_jianding" name="sancai_jianding" class="sancai_jianding"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>公估费</span>
                            <input readonly type="text" placeholder="公估费" id="sancai_gonggu" name="sancai_gonggu" class="sancai_gonggu"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>住宿费</span>
                            <input readonly type="text" placeholder="住宿费" id="sancai_zhusu" name="sancai_zhusu" class="sancai_zhusu"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>路桥费</span>
                            <input readonly type="text" placeholder="路桥费" id="sancai_luqiao" name="sancai_luqiao" class="sancai_luqiao"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>燃油费</span>
                            <input readonly type="text" placeholder="燃油费" id="sancai_ranyou" name="sancai_ranyou" class="sancai_ranyou"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>其他</span>
                            <input readonly type="text" placeholder="其他" id="sancai_qita" name="sancai_qita" class="sancai_qita"
                                   oninput="vs666()">
                        </div>
                        <div class="input dong">
                            <span>汇总</span>
                            <input readonly type="text" placeholder="汇总" id="sancai_huizong" name="sancai_huizong" class="sancai_huizong">
                        </div>
                    </div>
                    <div class="conts" style="">
                        <div class="input dong">
                            <span>核定诉讼费</span>
                            <input type="text" placeholder="诉讼费" id="hd_sancai_susong" name="hd_sancai_susong" class="hd_sancai_susong"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定鉴定费</span>
                            <input type="text" placeholder="鉴定费" id="hd_sancai_jianding" name="hd_sancai_jianding" class="hd_sancai_jianding"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定公估费</span>
                            <input type="text" placeholder="公估费" id="hd_sancai_gonggu" name="hd_sancai_gonggu" class="hd_sancai_gonggu"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定住宿费</span>
                            <input type="text" placeholder="住宿费" id="hd_sancai_zhusu" name="hd_sancai_zhusu" class="hd_sancai_zhusu"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定路桥费</span>
                            <input type="text" placeholder="路桥费" id="hd_sancai_luqiao" name="hd_sancai_luqiao" class="hd_sancai_luqiao"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定燃油费</span>
                            <input type="text" placeholder="燃油费" id="hd_sancai_ranyou" name="hd_sancai_ranyou" class="hd_sancai_ranyou"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定其他</span>
                            <input type="text" placeholder="其他" id="hd_sancai_qita" name="hd_sancai_qita" class="hd_sancai_qita"
                                   oninput="hd_sancai_input()">
                        </div>
                        <div class="input dong">
                            <span>核定汇总</span>
                            <input type="text" placeholder="汇总" id="hd_sancai_huizong" name="hd_sancai_huizong" class="hd_sancai_huizong">
                        </div>
                    </div>
                    <script>
                        function hd_sancai_input() {
                            var hd_sancai_susong = $("#hd_sancai_susong").val();
                            var hd_sancai_jianding = $("#hd_sancai_jianding").val();
                            var hd_sancai_gonggu = $("#hd_sancai_gonggu").val();
                            var hd_sancai_zhusu = $("#hd_sancai_zhusu").val();
                            var hd_sancai_luqiao = $("#hd_sancai_luqiao").val();
                            var hd_sancai_ranyou = $("#hd_sancai_ranyou").val();
                            var hd_sancai_qita = $("#hd_sancai_qita").val();
                            var sum = Number(hd_sancai_susong) + Number(hd_sancai_jianding) + Number(hd_sancai_gonggu) + Number(hd_sancai_zhusu) + Number(hd_sancai_luqiao) + Number(hd_sancai_ranyou) + Number(hd_sancai_qita);
                            if (!isNaN(sum)) {
                                $("#hd_sancai_huizong").val(sum.toFixed(2));
                            }
                        }

                        function baocun_sancai_hd(sub) {
                            var bid = "{$bid}";
                            var hd_sancai_susong = $("#hd_sancai_susong").val();
                            var hd_sancai_jianding = $("#hd_sancai_jianding").val();
                            var hd_sancai_gonggu = $("#hd_sancai_gonggu").val();
                            var hd_sancai_zhusu = $("#hd_sancai_zhusu").val();
                            var hd_sancai_luqiao = $("#hd_sancai_luqiao").val();
                            var hd_sancai_ranyou = $("#hd_sancai_ranyou").val();
                            var hd_sancai_qita = $("#hd_sancai_qita").val();
                            var hd_sancai_huizong = $("#hd_sancai_huizong").val();

                            $.ajax({
                                url: "{:url('bshenhe/baocun_sancai_hd')}",
                                data: {
                                    bid: bid,
                                    hd_sancai_susong: hd_sancai_susong,
                                    hd_sancai_jianding: hd_sancai_jianding,
                                    hd_sancai_gonggu: hd_sancai_gonggu,
                                    hd_sancai_zhusu: hd_sancai_zhusu,
                                    hd_sancai_luqiao: hd_sancai_luqiao,
                                    hd_sancai_ranyou: hd_sancai_ranyou,
                                    hd_sancai_qita: hd_sancai_qita,
                                    hd_sancai_huizong: hd_sancai_huizong
                                },
                                type: 'post',
                                dataType: 'json',
                                success: function (res) {
                                    layer.msg(res.msg);
                                }
                            })
                        }
                    </script>
                    {/if}
                    <script>
                        function vs666() {
                            var sancai_susong = document.getElementById('sancai_susong').value;
                            var sancai_jianding = document.getElementById('sancai_jianding').value;
                            var sancai_gonggu = document.getElementById('sancai_gonggu').value;
                            var sancai_zhusu = document.getElementById('sancai_zhusu').value;
                            var sancai_luqiao = document.getElementById('sancai_luqiao').value;
                            var sancai_ranyou = document.getElementById('sancai_ranyou').value;
                            var sancai_qita = document.getElementById('sancai_qita').value;
                            var sancai_huizong = document.getElementById('sancai_huizong');
                            var number = (Number(sancai_susong) + Number(sancai_jianding) + Number(sancai_gonggu) + Number(sancai_zhusu) + Number(sancai_luqiao) + Number(sancai_ranyou) + Number(sancai_qita)).toFixed(2);
                            if (number != 'NaN') {
                                sancai_huizong.value = number;
                            }
                        }
                    </script>
                    <div class="conts">
                        <span style="width:98%;margin: 1%;">备注说明</span>
                        <textarea id="beizhu666" name="beizhu" cols="30" rows="10"
                                  style="width:98%;height: 100px;margin: 1%;"></textarea>
                    </div>
                    <div class="conts">
                        <div class="input">
                            {if $scwusun[0]['status'] eq 3}
                            <button type="button" onclick="baocun_sancai_hd()" style="margin: 1%;margin-top:20px;">保存
                            </button>
                            {/if}
<!--                            <button type="button" onclick="closeDialoga666()" style="margin: 1%;margin-top:20px;">关闭-->
<!--                            </button>-->
                        </div>
                    </div>
                    <!--</div>-->
                </form>
            </div>
        </div>
    </div>
    <div id="fade666" class="black_overlay"></div>
    <script>
        $('#chesun_4').click(function () {
            var chesun_4_text = $('#chesun_4_text').val();
            if (chesun_4_text == '') {
                layer.msg("请输入审核原因");
                return false
            }
            layer.confirm('确定' + $(this).text() + '？', {icon: 3, title: $(this).text()}, function (index) {
                $.ajax({
                    url: "{:url('bushen/hejia/shenhe_post')}",
                    data: {
                        id: "{$orderid}",
                        bid: "{$bid}",
                        chesun_4: 3,
                        tuihui: chesun_4_text,
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg(res.msg, {time: 2000}, function () {
                                layer.closeAll()
                                parent.layer.closeAll();
                                parent.$("#table").bootstrapTable('refresh', {});
                            });
                        } else {
                            layer.msg(res.msg);
                        }
                    }
                })
            });
        })

        $('#chesun_41').click(function () {
            layer.confirm('确定' + $(this).text() + '？', {icon: 3, title: $(this).text()}, function (index) {
                $.ajax({
                    url: "{:url('bshenhe/shenhe_post')}",
                    data: {
                        id: "{$orderid}",
                        bid: "{$bid}",
                        chesun_4: 3,
                        tuihui: $.trim($('#chesun_4_text').val()),
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        layer.close(index);
                        layer.msg(res.msg);
                        if (res.code == 1) {
                            window.location.href = 'fenxiang';
                        }
                        //$('#chesun_4').hide();
                        // $('#chesun_bk3').hide();
                    }
                })
            });
        })

        $('#chesun_42').click(function () {
            layer.confirm('确定' + $(this).text() + '？', {icon: 3, title: $(this).text()}, function (index) {
                $.ajax({
                    url: "{:url('bshenhe/shenhe_post')}",
                    data: {
                        id: "{$orderid}",
                        bid: "{$bid}",
                        chesun_4: 3,
                        tuihui: $.trim($('#chesun_4_text').val()),
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        layer.close(index);
                        layer.msg(res.msg);
                        if (res.code == 1) {
                            window.location.href = 'fenxiang';
                        }
                        //$('#chesun_4').hide();
                        // $('#chesun_bk3').hide();
                    }
                })
            });
        })

        $('#chesun_43').click(function () {
            layer.confirm('确定' + $(this).text() + '？', {icon: 3, title: $(this).text()}, function (index) {
                $.ajax({
                    url: "{:url('bshenhe/shenhe_post')}",
                    data: {
                        id: "{$orderid}",
                        bid: "{$bid}",
                        chesun_4: 3,
                        tuihui: $.trim($('#chesun_4_text').val()),
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        layer.close(index);
                        layer.msg(res.msg);
                        if (res.code == 1) {
                            window.location.href = 'fenxiang';
                        }
                        //$('#chesun_4').hide();
                        // $('#chesun_bk3').hide();
                    }
                })
            });
        })

        $('#chesun_bk4').click(function () {
            layer.confirm('确定' + $(this).text() + '？', {icon: 3, title: $(this).text()}, function (index) {
                var chesun_4_text = $('#chesun_4_text').val();
                if (chesun_4_text == '') {
                    layer.msg("请输入审核原因");
                    return false
                }
                $.ajax({
                    url: "{:url('bushen/hejia/shenhe_post')}",
                    data: {
                        id: "{$orderid}",
                        bid: "{$bid}",
                        chesun_4: 2,
                        tuihui: chesun_4_text,
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg(res.msg, {time: 2000}, function () {
                                layer.closeAll()
                                parent.layer.closeAll();
                                parent.$("#table").bootstrapTable('refresh', {});
                            });
                        } else {
                            layer.msg(res.msg);
                        }
                    }
                })
            });
        })
    </script>
    <script>
        function closeDialoga666() {
            $('#light666').css("display",'none');
            $('#fade666').css("display",'none')
        }

        function openDialogs666(id) {
            if (id == '') {
                layer.msg('系统异常2');
                return false;
            }
            // 1. 先打开弹窗（显示加载中状态）
            var $light2Content = $('#light666').contents(); // 先保存引用
            var layerIndex = layer.open({
                type: 1,
                title: '加载中...',
                content: `
                    <div style="
                      position: absolute;
                      top: 50%;
                      left: 50%;
                      transform: translate(-50%, -50%);
                      text-align: center;
                    ">
                      <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
                      <p style="margin-top: 10px">加载中...</p>
                    </div>
                  `,
                end: function() {
                    // 弹窗关闭时，把内容放回 #light2
                    $('#light666').append($light2Content);
                },
                area: ['80%', '80%'],
                shadeClose: false // 禁止点击遮罩关闭
            });
            $.ajax({
                url: "{:url('bushen/hejia/liulan_cai')}",
                data: {id: id},
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.status == true) {
                        if (res.data.scwusun.status == 0) {
                            $(".sancai_add").show();
                            $(".sancai_del").show();
                            $(".sancai_save").show();
                            $(".sancai_save").show();
                            $(".sancai_save_2").show();
                        } else {
                            $(".sancai_add").hide();
                            $(".sancai_del").hide();
                            $(".sancai_save").hide();
                            $(".sancai_save").hide();
                            $(".sancai_save_2").hide();
                        }

                        var html3 = '';
                        if (res.data.sancai.length > 0) {
                            for (var i = 0; i < res.data.sancai.length; i++) {
                                html3 += "<tr>" +
                                    "<td><input type='checkbox' style='width: 15px;height: 15px;display: block;' name='id' class='bid2' value=" + res.data.sancai[i].id + "></td>" +
                                    "<td><input type='text' name='xuhao' readonly class='xuhao2' value=" + res.data.sancai[i].xuhao + "></td>" +
                                    // "<td><input type='text' name='type' class='type2' list='tongchou46' value=" + res.data.sancai[i].type + ">" +
                                    "<datalist id='tongchou46'>" +
                                    "<option value='机动车损失服务'>机动车损失服务</option>" +
                                    "<option value='机动车第三者责任服务'>机动车第三者责任服务</option>" +
                                    "<option value='机动车全车盗抢服务'>机动车全车盗抢服务</option>" +
                                    "<option value='自燃损失服务'>自燃损失服务</option>" +
                                    "<option value='发动机涉水损失服务'>发动机涉水损失服务</option>" +
                                    "<option value='指定修理厂服务'>指定修理厂服务</option>" +
                                    "<option value='车上货物责任服务'>车上货物责任服务</option>" +
                                    "<option value='玻璃单独破碎服务'>玻璃单独破碎服务</option>" +
                                    "</datalist></td>" +
                                    "<td><input type='text' name='name' class='name2' value=" + res.data.sancai[i].name + "></td>" +
                                    "<td><input type='text' name='fangan' class='fangan2' list='sancais' value=" + res.data.sancai[i].fangan + ">" +
                                    "<datalist id='sancais'>" +
                                    "<option value='4S店维修'>4S店维修</option>" +
                                    "<option value='一类修理厂'>一类修理厂</option>" +
                                    "<option value='二类修理厂'>二类修理厂</option>" +
                                    "<option value='三类修理厂'>三类修理厂</option>" +
                                    "</datalist></td>" +
                                    "<td><input type='text' readonly name='price' class='price2' oninput='v26()' value=" + res.data.sancai[i].price + "></td>" +
                                    "<td><input type='text' readonly name='num' class='num2' oninput='v26()' value=" + res.data.sancai[i].num + "></td>" +
                                    "<td><input type='text' name='money' class='money2' oninput='v26()' value=" + res.data.sancai[i].money + "></td>" +
                                    /* "<td><input type='text' name='zhekou' class='zhekou2' oninput='v26()' value=" + res.data.sancai[i].zhekou + "></td>" +*/
                                    "<td><input type='text'  name='price_he' class='hd_e_price' oninput='hd_e()' value=" + res.data.sancai[i].price_he + "></td>" +
                                    "<td><input type='text' name='num_he' class='hd_e_num' oninput='hd_e()' value=" + res.data.sancai[i].num_he + "></td>" +
                                    "<td><input type='text' name='hejia' class='hd_e_hejia' oninput='hd_e()' value=" + res.data.sancai[i].hejia + "></td>" +
                                    "<td><input type='text' name='beizhu' class='beizhu2' value=" + res.data.sancai[i].beizhu + "></td>" +
                                    "</tr>";
                            }
                        } else {
                            html3 += "<tr>" +
                                "<td><input type='checkbox' style='width: 15px;height: 15px;display: block;' name='id' class='bid2' value=''></td>" +
                                "<td><input type='text' name='xuhao' value='1' readonly class='xuhao2'></td>" +
                                "<td><input type='text' name='type' class='type2' list='tongchou46'>" +
                                "<datalist id='tongchou46'>" +
                                "<option value='机动车损失服务'>机动车损失服务</option>" +
                                "<option value='机动车第三者责任服务'>机动车第三者责任服务</option>" +
                                "<option value='机动车全车盗抢服务'>机动车全车盗抢服务</option>" +
                                "<option value='自燃损失服务'>自燃损失服务</option>" +
                                "<option value='发动机涉水损失服务'>发动机涉水损失服务</option>" +
                                "<option value='指定修理厂服务'>指定修理厂服务</option>" +
                                "<option value='车上货物责任服务'>车上货物责任服务</option>" +
                                "<option value='玻璃单独破碎服务'>玻璃单独破碎服务</option>" +
                                "</datalist></td>" +
                                "<td><input type='text' name='name' class='name2'></td>" +
                                "<td><input type='text' name='fangan' class='fangan2' list='sancais'>" +
                                "<datalist id='sancais'>" +
                                "<option value='4S店维修'>4S店维修</option>" +
                                "<option value='一类修理厂'>一类修理厂</option>" +
                                "<option value='二类修理厂'>二类修理厂</option>" +
                                "<option value='三类修理厂'>三类修理厂</option>" +
                                "</datalist></td>" +
                                "<td><input type='text' name='price' class='price2' oninput='v26()'></td>" +
                                "<td><input type='text' name='num' class='num2' oninput='v26()'></td>" +
                                "<td><input type='text' name='money' class='money2' oninput='v26()'></td>" +
                                /*"<td><input type='text' name='zhekou' class='zhekou2' value='100' oninput='v26()'></td>" +*/
                                "<td><input type='text' readonly name='price_he' class='price_he2' oninput='v26()'></td>" +
                                "<td><input type='text' readonly name='num_he' class='num_he2' oninput='v26()'></td>" +
                                "<td><input type='text' readonly name='hejia' class='hejia2' oninput='v26()'></td>" +
                                "<td><input type='text' name='beizhu' class='beizhu2'></td>" +
                                "</tr>";
                        }

                        $("#tabProduct46 tr").slice(1).remove();
                        $('#tabProduct46').append(html3);
                        setTimeout(function(){
                            $('.bid').val(res.data.scwusun.id);
                            $('.c_money').val(res.data.scwusun.c_money);
                            // $('.c_hejia').val(res.data.scwusun.c_hejia);
                            $('.hd_e_money').val(res.data.scwusun.c_hejia);
                            $('.c_heji').val(res.data.scwusun.c_heji);
                            $('.c_canzhi').val(res.data.scwusun.c_canzhi);
                            $('.c_zongji').val(res.data.scwusun.c_zongji);
                            $('.sancai_susong').val(res.data.scwusun.sancai_susong);
                            $('.sancai_jianding').val(res.data.scwusun.sancai_jianding);
                            $('.sancai_gonggu').val(res.data.scwusun.sancai_gonggu);
                            $('.sancai_zhusu').val(res.data.scwusun.sancai_zhusu);
                            $('.sancai_luqiao').val(res.data.scwusun.sancai_luqiao);
                            $('.sancai_ranyou').val(res.data.scwusun.sancai_ranyou);
                            $('.sancai_qita').val(res.data.scwusun.sancai_qita);
                            $('.sancai_huizong').val(res.data.scwusun.sancai_huizong);
                            $('.beizhu666').val(res.data.scwusun.beizhu);
                            $(".hd_e_heji").val(res.data.scwusun.hd_c_heji);
                            $(".hd_e_canzhi").val(res.data.scwusun.hd_c_canzhi);
                            $(".hd_e_zongji").val(res.data.scwusun.hd_c_zongji);


                            $('.hd_sancai_susong').val(res.data.scwusun.hd_susong_fee);
                            $('.hd_sancai_jianding').val(res.data.scwusun.hd_jianding_fee);
                            $('.hd_sancai_gonggu').val(res.data.scwusun.hd_gonggu_fee);
                            $('.hd_sancai_zhusu').val(res.data.scwusun.hd_zhusu_fee);
                            $('.hd_sancai_luqiao').val(res.data.scwusun.hd_luqiao_fee);
                            $('.hd_sancai_ranyou').val(res.data.scwusun.hd_ranyou_fee);
                            $('.hd_sancai_qita').val(res.data.scwusun.hd_qita_fee);
                            $('.hd_sancai_huizong').val(Number(res.data.scwusun.hd_qita_fee)
                                + Number(res.data.scwusun.hd_susong_fee)
                                + Number(res.data.scwusun.hd_jianding_fee)
                                + Number(res.data.scwusun.hd_gonggu_fee)
                                + Number(res.data.scwusun.hd_zhusu_fee)
                                + Number(res.data.scwusun.hd_luqiao_fee)
                                + Number(res.data.scwusun.hd_ranyou_fee)
                            );
                        },200)

                        //
                        v26();


                        hd_e();


                        layer.title('详情', layerIndex); // 修改标题
                        $('#layui-layer' + layerIndex)
                            .find('.layui-layer-content')
                            .empty() // 先清空目标容器
                            .append($('#light666').contents()); // 移动 #light2 的子节点（不复制）

                        // layer.title('详情', layerIndex); // 修改标题
                        // $('#layui-layer' + layerIndex).find('.layui-layer-content').html($('#light666').html()); // 更新内容
                    }else{
                        layer.msg(res.msg || '数据加载失败', {icon: 2});
                    }
                }
            })
        }

        function test666() {
            var div6 = document.getElementById("div6");
            if (div6.style.display == "block") {
                div6.style.display = "none";
            } else {
                div6.style.display = "block";
            }
        }
    </script>
    <script>
        function hd_sanwu(sub) {
            layer.confirm('请确认是否已填完数据',{
                icon: 3
            }, function (index) {
                var ids = $('.bid2');
                var price = $('.hd_e_price');
                var num = $('.hd_e_num');
                var money = $('.hd_e_hejia');
                var bid = $('.bid').val()

                var e_id = new Array();
                var e_price = new Array();
                var e_num = new Array();
                var e_money = new Array();

                for (var i = 0; i < ids.length; i++) {
                    e_id[i] = ids[i].value;
                }
                for (var i = 0; i < price.length; i++) {
                    e_price[i] = price[i].value;
                }
                for (var i = 0; i < num.length; i++) {
                    e_num[i] = num[i].value;
                }
                for (var i = 0; i < money.length; i++) {
                    e_money[i] = money[i].value;
                }

                var hd_e_heji = $("#hd_e_heji").val();
                var hd_e_canzhi = $("#hd_e_canzhi").val();
                var hd_e_zongji = $("#hd_e_zongji").val();

                $.ajax({
                    url: "{:url('bushen/hejia/hd_sanwus')}",
                    data: {
                        id: e_id,
                        price: e_price,
                        num: e_num,
                        money: e_money,
                        bid: bid,
                        hd_e_heji: hd_e_heji,
                        hd_e_canzhi: hd_e_canzhi,
                        hd_e_zongji: hd_e_zongji,
                    },
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        layer.msg(res.msg);
                        return false;
                    }
                })
            });
        }

        function hd_e() {
            var price = $('.hd_e_price');
            var num = $('.hd_e_num');
            var money = $('.hd_e_hejia');
            var sum = 0;
            for (var i = 0; i < price.length; i++) {
                money[i].value = price[i].value * num[i].value;
                sum += price[i].value * num[i].value;
            }
            $(".hd_e_money").val(sum.toFixed(2));
            $(".hd_e_heji").val(sum.toFixed(2));
            var hd_e_canzhi = $(".hd_e_canzhi").val();
            var hd_e_zongji = sum - Number(hd_e_canzhi);
            if (!isNaN(hd_e_zongji)) {
                $(".hd_e_zongji").val(hd_e_zongji);
            }
        }
    </script>
</div>